Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

MCP hello world

S1mon
S1mon Member Posts: 4,648 PRO

My access to the FeatureScript MCP showed up today. Just made my first test feature. Still getting the hang of it. I had an agent.md, and other notes about FS coding in a local directory to guide Codex previously before this. I was also using GitHub for storage and version control etc.

Where should my personal guidance for Codex live when using the Onshape MCP? I understand that FeatureScript MCP Notes.md is the built in way to do so, but to edit that manually I would need to copy/paste from an external editor. I can do that, but just want to make sure that's the appropriate way to do things.

I was using a GitHub clone of the Onshape Std Library source for reference for my agent. I would tell it "go look at hole.fs and use the design pattern for…" or "start with bridgingCurve.fs and modify it to do…". This was often helpful. What should I do now to avoid wasting API tokens or server calls? Should I still use the std library clone?

My agent noticed that the Onshape MCP doesn't allow for creating versions from my agent.

Two remaining gaps

The current MCP tools do not expose named Onshape Version creation or rollback. Ordinary workspace history should still exist, but I recommend manually creating named Versions at Beta/Public checkpoints unless Labs adds that tool.

The MCP can compile and execute features, but it cannot fully validate interactive UI behavior such as feature-dialog visibility, manipulator dragging, or stale Part Studio regeneration. Those still require a manual Onshape UI acceptance check for UI-heavy features.

Are all development efforts only in a singleFeatureScript MCP Workspacedocument? Can I tell it to work somewhere else? In the intro video, @cody_armstrong tells Claude to create a new feature in a specific cad.onshape.com document link, but then it shows it happening in the FeatureScript MCP Workspace document. This is confusing.

Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

Comments

  • Konst_Sh
    Konst_Sh Member Posts: 170 PRO

    it would be a pity if the scope of this MCP would only be limited to a single-document work, there are plenty of situations where cross document actions are required like instantiating templates, copying features, running tricky searches. So you say every feature studio read and update will count as a limited api call?

    CADSharp - Onshape custom programming services + Onshape mechanical design services

  • cody_armstrong
    cody_armstrong Moderator, Onshape Employees, Developers, csevp Posts: 229 image

    @S1mon A few things to note: the FeatureScript MCP server is specific to creating custom features. We will expand on our MCP capabilities and supported use cases in the future.

    @Konst_Sh yes, this uses multiple API calls. The number of API calls depends on a number of factors.

    @S1mon Regarding telling it to work somewhere else, you can tell it to put the finished feature in any Document you want (which is what you saw), but importantly, the FeatureScript MCP Workspace document is your AI's sandbox for experimentation. We are deliberately drawing that delineation so your AI can have a place to experiment without affecting your working Document.

  • S1mon
    S1mon Member Posts: 4,648 PRO
    edited August 1

    @cody_armstrong

    The MCP connection consumes a lot of tokens. For a very simple feature (basic box at the origin), it took 49 tokens for a one shot round. My previous approach where I had Codex use a script and the API to check what was in the Feature Studio and then push an update to a document took 4 tokens for each round trip. I need to do more investigating, but an order of magnitude more tokens doesn’t seem like a good direction unless tokens are going to get a lot cheaper.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • cody_armstrong
    cody_armstrong Moderator, Onshape Employees, Developers, csevp Posts: 229 image

    @S1mon 4 tokens is the equivalent of 3 to 4 words. Creating custom features (even simple ones) will require more than this.

  • S1mon
    S1mon Member Posts: 4,648 PRO

    As a follow on, I finally got a price recently for API tokens. I ran out of my 2500/yr that comes with a Standard account. Support granted an additional 2500 for free (Thanks!) Beyond that, 50k tokens are $1.5k or $0.03/token. So $1.47 for my first round with MCP.

    I haven’t had enough time with the new tooling to see if over the long run if using the MCP will be any more efficient. There are instructions to the agent and a bunch of commands beyond the basic API tools of reading and writing to a FS tab. I’ll enumerate these as I start to understand/use it.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • S1mon
    S1mon Member Posts: 4,648 PRO
    edited August 1

    I'm not sure I understand this. Just using the API, it's one token to POST an update to a FeatureStudio, even if that update was 20k lines of code.

    image.png

    The way I had it set up with Codex, it took 4 tokens total:

    image.png

    From what I can get from the MCP server, it seems like there are bunch of calls available now:

    —
    According to the server’s own metadata, all fourteen Onshape Labs tools consume your Onshape API allocation. None are advertised as free.

    This includes even read-only or administrative calls:

    • read_featurescript_notes
    • get_featurescript
    • list_feature_studios
    • search_featurescript_documentation
    • get_api_usage
    • whoami
    • set_api_allocation
    • logout

    And all write/test calls:

    • edit_featurescript_notes
    • create_feature_studio
    • put_featurescript
    • test_featurescript
    • test_feature
    • create_geometry

    One MCP tool call may translate into multiple Onshape REST requests. test_feature and especially create_geometry likely consume more than simple reads because their documented workflows perform several operations. The server does not publish an exact per-tool request cost.

    These operations are free with respect to the Onshape API allocation:

    • Viewing tool descriptions/schemas
    • Listing MCP resources or resource templates
    • codex mcp list and codex mcp get
    • Reading the local Markdown guide
    • Ordinary conversation and code drafting without invoking a tool
    • Working directly in the Onshape browser UI rather than through MCP

    Even get_api_usage consumes allocation, so checking the meter itself is not completely free.

    —

    I'm still not sure I understand why the new MCP connection consumes so many. Using my 4 tokens per turn tooling, I burned through 2500 tokens in a couple months of vibe coding. Based on the costing I have now, that's $75, which is not much compared to the $200/month I'm paying to OpenAI, but still... If each turn through MCP is going to burn through many more tokens, I'm hoping that the tooling results in more efficient turns.

    One thing I would really love to see in the MCP connection is better tooling for profiling. My approach previously was, first, to screenshot the profile and tell it to work on the slower stuff, and later, to have it scrape the profile using browser skills.

    It's still weird to me that I can do a lot of things for "free" by having Codex use the browser instead of using the API or MCP. From Onshape's perspective I would think the cost of serving up full web pages and their interactions would be higher that the cost to respond to an API call or MCP call. The reality is that interacting through the browser is more brittle than direct API or MCP connections, but it's gotten much much better over time. I'd love to understand more about this costing.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • Konst_Sh
    Konst_Sh Member Posts: 170 PRO

    Maybe there is a confusion between llm tokens and api calls count which you call here api tokens. Because 20 api calls to just update or read the feature studio is too much obv

    CADSharp - Onshape custom programming services + Onshape mechanical design services

  • S1mon
    S1mon Member Posts: 4,648 PRO

    I have a monthly LLM subscription and have never run out of those tokens, even on the highest settings. I don't pay much attention to them.

    I checked my Onshape API Tokens before and after the first feature was created. 2504 and then 2553, or 49 different. I will watch this more carefully each time, but that seemed like a lot for one short very simple feature. (Note that Codex made a really rookie mistake and made some defaults that don't work)

    FeatureScript 3029;
    import(path : "onshape/std/common.fs", version : "3029.0");
    
    // Feature: MCPTestBlock
    // Phase: Draft
    // Build: 2026-07-31 — Initial MCP workflow demonstration
    // Compatibility: Breaking changes allowed
    
    annotation { "Feature Type Name" : "MCPTestBlock" }
    export const mcpTestBlock = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Width" }
            isLength(definition.width, NONNEGATIVE_LENGTH_BOUNDS);
    
            annotation { "Name" : "Depth" }
            isLength(definition.depth, NONNEGATIVE_LENGTH_BOUNDS);
    
            annotation { "Name" : "Height" }
            isLength(definition.height, NONNEGATIVE_LENGTH_BOUNDS);
    
            annotation { "Name" : "Centered on origin", "Default" : true }
            definition.centered is boolean;
        }
        {
            const minimumSize = 0.1 * millimeter;
            const width = max(definition.width, minimumSize);
            const depth = max(definition.depth, minimumSize);
            const height = max(definition.height, minimumSize);
    
            var corner1 = vector(0 * millimeter, 0 * millimeter, 0 * millimeter);
            var corner2 = vector(width, depth, height);
            if (definition.centered)
            {
                corner1 = vector(-width / 2, -depth / 2, 0 * millimeter);
                corner2 = vector(width / 2, depth / 2, height);
            }
    
            fCuboid(context, id + "block", {
                "corner1" : corner1,
                "corner2" : corner2
            });
        },
        {
            "width" : 40 * millimeter,
            "depth" : 30 * millimeter,
            "height" : 20 * millimeter,
            "centered" : true
        });
    
    

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • Konst_Sh
    Konst_Sh Member Posts: 170 PRO

    Well then my final guess is that it could spend some considerable amount of api calls to establish the session first and then just few calls per push/pull action.

    CADSharp - Onshape custom programming services + Onshape mechanical design services

  • joshtargo
    joshtargo Member Posts: 696 EDU

    At the most basic level is the mcp connection meant to allow AI to read, edit, and write code directly to the feature studio, rather than needing to copy-paste back and forth?

  • S1mon
    S1mon Member Posts: 4,648 PRO


    Yes. It also seems to have some debugging and documentation references built in, but I’m still learning about those.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • paul_chastell
    paul_chastell Onshape Employees Posts: 133 image

    I’m in the middle of a vacation right now but couldn’t help but check into the latest forum posts and then couldn’t stop myself replying.

    I’m going to discuss some of the core principles and that may answer some of the questions.

    An MCP server is in some ways like an api but provides tools that can be more focused on AI workflows. The labs FS server contains tools specifically related to writing, debugging, reading and modifying feature studios. It cannot create workspaces in documents* or create versions. It cannot create features*. It can list and read all the feature studios in a specific document but it cannot list all the documents you have access to.

    The intent is that the tools are limited in scope. The ai only has access to documents (plus a specific workspace or version) that you either tell it about or that it infers from feature studio imports or error call stacks (or through other methods other than this MCP server). And what it can do with those is limited. This restricts what the tools can do and therefore what the AI can do.

    The tools can completely trash a feature studio or break it in some less obvious way but that event is in the document history and can be reverted. One plausible workflow is to create a workspace specifically for the AI to work in (through the UI) and give it THAT reference, ensuring a specific branch for it to work on. Or point it at a version of a doc if you want it to plan work or do some debugging or analysis of code.

    You can work on multiple feature studios at the same time, though the ai needs some coaching as to the best way to do that. You may well see improvements in this area over time. Hearing from our users about tasks that are hard to do well today with the existing set of tools is one of the reasons labs exists.

    * The tools CAN create and destroy workspaces in docs, and features in part studios but ONLY in the limited scope of the “working document” via certain tools, which is why that document exists, to allow an AI to do more destructive work, in a sandbox.

    The FS notes doc provides a convenient memory in a way that can be better shared in an Onshapey way with other users. A more experienced user can also use other files, with skills or instructions, to guide whichever AI they are using, however best suits that AI client. You may see us release companion public repos with such skills at some point, which could improve the overall workflow using the labs FS MCP server.

    One request to an AI may result in multiple tool calls. Making even a simple change requires the ai to call tools to search docs, read code, test code, test code again, and again, then write the result. Labs will help us determine how to provide better tools, skills, guidelines and so on to allow an AI to use the tools more efficiently, with the goal of reducing both ai token use and tool use. Calls to each labs MCP server tool will consume a variable number of API calls. We expect to optimize the number of such API calls over the coming weeks.

    Paul Chastell
    TVP, Onshape Labs
  • S1mon
    S1mon Member Posts: 4,648 PRO
    edited August 8

    FWIW, between Codex/ChatGPT Sol 5.6 High and this MCP connection, I have a session running now where it copied my single test case, and created 5 more part studio tabs to test other cases. It's editing the part studios directly using Chrome. My mind is exploding.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    @cody_armstrong do you have a video? This is really interesting. How do you create a sandbox? Should someone create a new free account?

    @paul_chastell how does ai run in an account without an apikey?

    I'm glad you're looking into this.

  • cody_armstrong
    cody_armstrong Moderator, Onshape Employees, Developers, csevp Posts: 229 image
    edited August 11

    @billy2 Videos will be coming soon with more detail. In short, your AI agent will create a FeatureScript MCP Workspace Document (sandbox) and Notes document the first time you interact with it. You do not need a separate account. Your AI authenticates with your Onshape account (using OAuth) as part of connecting to the MCP server. You do not use API keys.

    It is now available to all, so you can get started here. https://cad.onshape.com/appstore/apps/Onshape%20Labs/6a29aea7c03f8bf659841734

    The process of adding an MCP server to your AI varies depending on which AI use choose, but generally speaking, if they support the MCP protocol, they will have instructions for how to connect published on their site.

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited August 11

    @cody_armstrong exciting…. am I transferring tab data through a portal and AI is not running inside onshape? Is it as simple as just scraping the results to AI and then updating FS doc from the update that AI produces? In reality, your just removing the cut'n paste process some one would have to do manually? It scares me less if your just automating the cut-n-paste process.

    I was thinking, with the api I can update the FS tab but can I get to the results or compile errors? Is that now an api call? Are run time errors and compile errors now an api call?

    If I pretend I'm kimi can I write my own .mcp and make it open source? I'm not interested in vscode and vib coding, I more interested in attaching my server up to it so my agents can evolve and become a better programmers over time.

    Where is this heading?

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    @cody_armstrong sorry, but if you're running localhost, then your computer is authorized (if you're logged into to onshape) and another tab has access to the sandbox, a program has access, so local vscode will run and you can also console into the mcp. If you're crazy enough, you could powershell into the .mcp if you're on a PC. Right?

    If you're a server in the cloud than you authorize using the old python code that does work any longer, at least on my site.

    If you register in the api store can I access other onshape users data if they allow it? Can my smart agents become another users smart agents?

    This is crazy

  • cody_armstrong
    cody_armstrong Moderator, Onshape Employees, Developers, csevp Posts: 229 image
    edited August 11

    @billy2 the AI is not running in Onshape, the FeatureScript MCP server is a (FeatureScript-specific) toolkit for connecting Onshape to your AI tool of choice (Claude, Chatgpt, Gemini, etc).

    it is removing the cut and paste, but it does more. The loop is closed. The AI writes FeatureScript, the server writes it to the Feature Studio, evaluates it, and hands the compile errors and evaluation results back to the model. Instead of you pasting an error into a chat window, the model sees it and fixes it. Same loop you'd run by hand. Yes, the testing and evaluation of errors also consume API calls.

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    This is moving fast, it's exciting. I've used the API a lot and never knew it had limitations. 2,500/yr doesn't seem right. I've blown past that just trying to change part colors in an assembly. It seems to me that if I'm using AI, it needs to remember skills so it doesn't keep figuring out the same problems. With anti-gravity, at the end of a session, I can just have it write everything learned into a skill.md and use for the next project.

    It's going to be interesting to see how Onshape makes this work.

    I'm looking forward to the 2026 Aug 13th presentation.

    Screenshot 2026-08-12 at 9.09.07 AM.jpg

    The API doesn't give up compile errors or any stats about a feature script. This means you're stuck with the .mcp hookup. I don't want to start scraping OS and will wait until it's done correctly.

  • joshtargo
    joshtargo Member Posts: 696 EDU

    Used 99/2500 tokens (~4%) to make a FS that makes a box. I fear this is really not going to last long enough to build anything complex. But I guess that's what I get in a free account.

    Is there really still no way for Claude to simply type into my Feature Studio as I would, and read the console errors as I would without using Onshape tokens?

    image.png
  • S1mon
    S1mon Member Posts: 4,648 PRO

    Using Browser skills/plugins (depending on the LLM) you can get the agent to read/do things with the model and the console (without burning API tokens). Before the MCP setup, this is what I was doing. The reality is that it occasionally can get confused. Browser-based connections are getting better and less "brittle".

    Pushing the actual FeatureScript code updates was/is much more reliable if you use the API. With Codex/ChatGPT and its control over a separate Google profile, it can do a lot, and it's getting more and more powerful. The other day it added part studios and create multiple test cases for a FS I was developing, without any clicking in Onshape from me.

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • joshtargo
    joshtargo Member Posts: 696 EDU

    I'm currently using this setup with Macro Recorder macro where CTRL-SHFT-C copies the VS code into my feature studio and hits enter for me. I may want another macro that copies the console text or a screenshot back into claude code so it can see what's going on when there's issues.

    2026-08-13 11 43 12.png
  • S1mon
    S1mon Member Posts: 4,648 PRO

    I was doing things with copy/paste many months ago. Trouble I kept having is that I would be doing something else while it was thinking and then the browser focus would get screwed up and the copy/paste would get screwed up. Getting ChatGPT to write some scripts to talk to the API to push/pull the code was really helpful, and now with the MCP server, that's even more automatic. I personally don't want to go back to the copy/paste level of tooling. Codex's ability to use Chrome is really powerful and it can do this in the background, so it can update or read from things in Onshape (e.g. FS profiling) that aren't available through the MCP or API.

    To some degree it depends on your token budget (both for your LLM and Onshape API).

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • S1mon
    S1mon Member Posts: 4,648 PRO
    edited August 13

    Just in case people don't see this, here's the official announcement/rollout:

    https://www.onshape.com/en/blog/featurescript-mcp-server-enables-text-code-cad

    and here's the webinar (which includes some overview of techniques, but not much detail of prompts etc - still well worth watching):

    Simon Gatrall | Product Development, Engineering, Design, Onshape | Ex- IDEO, PCH, Unagi, Carbon | LinkedIn

  • joshtargo
    joshtargo Member Posts: 696 EDU

    @S1mon i have a free regular account for Onshape, but also administer an education plan for our robot team. I think it's 2500 t/mo for onshape. i have a pro claude account and virtually never even hit the 5hr block limits, so essentially it's enough for me to code as much as i code. onshape api is the limiting factor. and since this is for personal/edu use, I cant justify paying for a pro OS account for more API use.

    my hybrid approach with macro for copypaste is quite good for now, it minimizes clicks, and using VS code and claude code on my desktop means it's working with a single source, rather than feeding me snippets to insert like i used to do through claude's regular web interface.

    The real missing benefit is MCP's closed loop error checking. maybe i save my tokens for very difficult sections.

  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO

    @cody_armstrong You're right, this is nothing like cut'n paste.

    I've been cranking on my computer after watching the video and trying to implement the mcp. I have nothing on my computer to perform cloud actions and I'm upgrading like mad to get my computer setup. I just discovered that gemini-cli won't authenticate through a browser any longer and they're pushing to me anti-gravity which is fine. I know gemini isn't a great code generator and will switch to something better after I get the mcp server working.

    My console will be OS authenticated simply by logging into onshape, right?

    Most the implementation is done using the CLI and talking directly with the mcp server, right? I don't like working local and would rather push all this to a remote server. I guess that's step 2 in the process for getting this set up.

    My remote server is authenticated because I can ask for a featurescript listing, right?

    Screenshot 2026-08-13 at 2.52.26 PM.jpg