microsoft / microsoft/documentdb-mcp
Refine Codebase with @modelcontextprotocol SDK
Open
@xingfan-git is already working on this.
Since Sep 24, 2025.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 4
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 3
Description
Currently the implementation exports all the tools as functions, which is not align with MCP server best practice.
In this task, refine current implementation with the following pattern, using registerTool\registerResource\registerPrompt to make the code in good structure.
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
// Create an MCP server
const server = new McpServer({
name: "demo-server",
version: "1.0.0"
});
// Add an addition tool
server.registerTool("add",
{
title: "Addition Tool",
description: "Add two numbers",
inputSchema: { a: z.number(), b: z.number() }
},
async ({ a, b }) => ({
content: [{ type: "text", text: String(a + b) }]
})
);
// Add a dynamic greeting resource
server.registerResource(
"greeting",
new ResourceTemplate("greeting://{name}", { list: undefined }),
{
title: "Greeting Resource", // Display name for UI
description: "Dynamic greeting generator"
},
async (uri, { name }) => ({
contents: [{
uri: uri.href,
text: `Hello, ${name}!`
}]
})
);
// Start receiving messages on stdin and sending messages on stdout
const transport = new StdioServerTransport();
await server.connect(transport);
Note:
- Before starting this task, run
git pull origin xingfan/instructionto ensure you are on the correct working branch. - The server should operate in BOTH HTTP mode and stdio mode.
- You need to maintain the ability to switch the connected cluster, and the server should be able to start even without a cluster connection string. Do not follow the current implementation for this feature; you may implement it as a wrapper of the mcp server, but it is required.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.