If you add endpoints to your FastAPI app after creating the MCP server, you’ll need to refresh the server to include them:
from fastapi import FastAPIfrom fastapi_mcp import FastApiMCPapp = FastAPI()mcp = FastApiMCP(app)mcp.mount_http()# Add new endpoints after MCP server creation@app.get("/new/endpoint/", operation_id="new_endpoint")async def new_endpoint(): return {"message": "Hello, world!"}# Refresh the MCP server to include the new endpointmcp.setup_server()
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"FastAPI MCP","description":"Convert your FastAPI app into a MCP server with zero configuration","colors":{"primary":"#6d45dc","light":"#9f8ded","dark":"#6a42d7"},"logo":{"light":"https://mintcdn.com/tadata-a67d782f/261DhWpwctN3OULB/media/dark_logo.png?fit=max\u0026auto=format\u0026n=261DhWpwctN3OULB\u0026q=85\u0026s=e9f9af96a41788e41f9b9309eb73ed2e","dark":"https://mintcdn.com/tadata-a67d782f/261DhWpwctN3OULB/media/light_logo.png?fit=max\u0026auto=format\u0026n=261DhWpwctN3OULB\u0026q=85\u0026s=f83360780c78b938d427252bd18788f0","href":"https://tadata.com/"},"favicon":"https://mintcdn.com/tadata-a67d782f/261DhWpwctN3OULB/media/favicon.png?fit=max\u0026auto=format\u0026n=261DhWpwctN3OULB\u0026q=85\u0026s=a80aacd40ac71953a91cb857c6cf756d","background":{"decoration":"windows","color":{"light":"#EEEEEE","dark":"#222831"}},"navbar":{"primary":{"type":"github","href":"https://github.com/tadata-org/fastapi_mcp"}},"footer":{"socials":{"x":"https://x.com/makhlevich","github":"https://github.com/tadata-org/fastapi_mcp","website":"https://tadata.com/"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://fastapi-mcp.tadata.com/"},{"anchor":"Community","icon":"slack","href":"https://join.slack.com/t/themcparty/shared_invite/zt-30yxr1zdi-2FG~XjBA0xIgYSYuKe7~Xg"},{"anchor":"Blog","icon":"newspaper","href":"https://medium.com/@miki_45906"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"tadata-a67d782f","hasAudioNarration":false,"actualSubdomain":"tadata-a67d782f","customDomains":["fastapi-mcp.tadata.com"],"gitSource":{"type":"github","owner":"tadata-org","repo":"fastapi_mcp","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":false},"entitlements":{},"buildId":"6a98beccfd77e1024206cd60","clientVersion":"0.0.4286","searchFilterCounts":[{"language":"default","tag":"Advanced Usage","count":5},{"language":"default","tag":"Getting Started","count":5},{"language":"default","tag":"Configurations","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"advanced/refresh","slug":"/advanced/refresh","pageMetadata":{"title":"Refreshing the Server","description":"Adding endpoints after MCP server creation","icon":"arrows-rotate","href":"/advanced/refresh"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Adding endpoints after MCP server creation\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`If you add endpoints to your FastAPI app after creating the MCP server, you’ll need to refresh the server to include them:`}),`\n`,_jsx(CodeBlock,{filename:``,highlight:`[9,10,11,12,15]`,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fastapi `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastAPI`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fastapi_mcp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastApiMCP`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastAPI()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mcp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FastApiMCP(app)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mcp.mount_http()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line line-highlight`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Add new endpoints after MCP server creation`})}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@app.get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/new/endpoint/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`operation_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"new_endpoint\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` new_endpoint`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello, world!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Refresh the MCP server to include the new endpoint`})}),`\n`,_jsx(_components.span,{className:`line line-highlight`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mcp.setup_server()`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Refreshing the Server","description":"Adding endpoints after MCP server creation","icon":"arrows-rotate","href":"/advanced/refresh"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"tadata-a67d782f","siteName":"FastAPI MCP","title":"Refreshing the Server - FastAPI MCP","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T10:01:13.034Z","originalFileLocation":"advanced/refresh.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Adding endpoints after MCP server creation\">\u003cmeta data-mint-head name=\"application-name\" content=\"FastAPI MCP\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Refreshing the Server - FastAPI MCP\">\u003cmeta data-mint-head property=\"og:description\" content=\"Adding endpoints after MCP server creation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"FastAPI MCP\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://fastapi-mcp.tadata.com/advanced/refresh\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://tadata-a67d782f.mintlify.site/_mintlify/api/og/v2?division=Advanced+Usage\u0026amp;title=Refreshing+the+Server\u0026amp;description=Adding+endpoints+after+MCP+server+creation\u0026amp;theme=140fac79f1e966eeca6e5dfe\u0026amp;signature=4857f642e2ab1d184346d0cfb12f6d4618533373209fdc12dae1b1c94e828d0f\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Refreshing the Server - FastAPI MCP\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Adding endpoints after MCP server creation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://tadata-a67d782f.mintlify.site/_mintlify/api/og/v2?division=Advanced+Usage\u0026amp;title=Refreshing+the+Server\u0026amp;description=Adding+endpoints+after+MCP+server+creation\u0026amp;theme=140fac79f1e966eeca6e5dfe\u0026amp;signature=4857f642e2ab1d184346d0cfb12f6d4618533373209fdc12dae1b1c94e828d0f\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/tadata-a67d782f/5VtFe0RycDwLfyn8/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"FastAPI MCP\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#6d45dc\">\u003clink data-mint-head rel=\"canonical\" href=\"https://fastapi-mcp.tadata.com/advanced/refresh\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/advanced/refresh.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://fastapi-mcp.tadata.com/#organization\",\"name\":\"FastAPI MCP\",\"url\":\"https://fastapi-mcp.tadata.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/tadata-a67d782f/261DhWpwctN3OULB/media/dark_logo.png?fit=max\u0026auto=format\u0026n=261DhWpwctN3OULB\u0026q=85\u0026s=e9f9af96a41788e41f9b9309eb73ed2e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://fastapi-mcp.tadata.com#website\",\"name\":\"FastAPI MCP\",\"url\":\"https://fastapi-mcp.tadata.com\",\"publisher\":{\"@id\":\"https://fastapi-mcp.tadata.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://fastapi-mcp.tadata.com/advanced/refresh#webpage\",\"url\":\"https://fastapi-mcp.tadata.com/advanced/refresh\",\"name\":\"Refreshing the Server\",\"description\":\"Adding endpoints after MCP server creation\",\"dateModified\":\"2026-01-07T10:01:13.034Z\",\"isPartOf\":{\"@id\":\"https://fastapi-mcp.tadata.com#website\"},\"breadcrumb\":{\"@id\":\"https://fastapi-mcp.tadata.com/advanced/refresh#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://fastapi-mcp.tadata.com/advanced/refresh#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Advanced Usage\",\"item\":\"https://fastapi-mcp.tadata.com/advanced/auth\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Refreshing the Server\",\"item\":\"https://fastapi-mcp.tadata.com/advanced/refresh\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://fastapi-mcp.tadata.com/advanced/refresh#article\",\"headline\":\"Refreshing the Server\",\"name\":\"Refreshing the Server\",\"description\":\"Adding endpoints after MCP server creation\",\"url\":\"https://fastapi-mcp.tadata.com/advanced/refresh\",\"mainEntityOfPage\":{\"@id\":\"https://fastapi-mcp.tadata.com/advanced/refresh#webpage\"},\"dateModified\":\"2026-01-07T10:01:13.034Z\",\"publisher\":{\"@id\":\"https://fastapi-mcp.tadata.com/#organization\"},\"isPartOf\":{\"@id\":\"https://fastapi-mcp.tadata.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"FastAPI MCP\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"FastAPI MCP\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/advanced/refresh.md","siteName":"FastAPI MCP","nav":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://fastapi-mcp.tadata.com/"},{"anchor":"Community","icon":"slack","href":"https://join.slack.com/t/themcparty/shared_invite/zt-30yxr1zdi-2FG~XjBA0xIgYSYuKe7~Xg"},{"anchor":"Blog","icon":"newspaper","href":"https://medium.com/@miki_45906"}]},"groups":[{"group":"Getting Started","pages":[{"title":"Welcome to FastAPI-MCP!","sidebarTitle":"Welcome!","icon":"hand-wave","href":"/getting-started/welcome"},{"title":"Installation","icon":"arrow-down-to-line","href":"/getting-started/installation"},{"title":"Quickstart","icon":"rocket","href":"/getting-started/quickstart"},{"title":"FAQ","icon":"question","href":"/getting-started/FAQ"},{"title":"Best Practices","icon":"thumbs-up","href":"/getting-started/best-practices"}]},{"group":"Configurations","pages":[{"title":"Tool Naming","icon":"input-text","href":"/configurations/tool-naming"},{"title":"Customization","icon":"pen","href":"/configurations/customization"}]},{"group":"Advanced Usage","pages":[{"title":"Authentication \u0026 Authorization","icon":"key","href":"/advanced/auth"},{"title":"Deploying the Server","icon":"play","description":null,"href":"/advanced/deploy"},{"title":"Refreshing the Server","icon":"arrows-rotate","href":"/advanced/refresh"},{"title":"Transport","description":"How to communicate with the FastAPI app","icon":"microchip","href":"/advanced/asgi"},{"title":"MCP Transport","icon":"car","href":"/advanced/transport"}]}]},"basePath":"","title":"Refreshing the Server - FastAPI MCP","deploymentId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","buildId":"dpl_G6E2ur2Zjq51xGTVZPSFXsWoTxCu","dynamics":[],"chunks":[]}